package com.demo.enums;

public enum RestFulStatus {

    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    OAUTH2_INVALID_CLIENT(21322, "client_id或client_secret参数无效"),
    OAUTH2_UNAUTHORIZED_CLIENT(21323, "客户端没有权限"),
    OAUTH2_ACCESS_DENIED(21324, "用户或授权服务器拒绝授予数据访问权限"),
    OAUTH2_CREATE_ACCESS_TOKEN_FAILED(21325, "创建Token失败"),
    OAUTH2_REQUEST_TOKE_NOT_EXIST(21326, "request_token不存在"),
    OAUTH2_ACCOUNT_INVALID(21327, "输入的帐号有误！"),
    OAUTH2_PASSWORD_INVALID(21328, "输入的密码有误！"),
    OAUTH2_AUTHORIZE_INVALID(21329, "帐号名或密码错误！"),
    OAUTH2_ACCOUNT_DISABLED(21330, "帐号已禁用！"),
    OAUTH2_ACCOUNT_UNAUTHORIZED(21331, "帐号没有权限"),
    OAUTH2_ACCESS_TOKEN_CHECK_FAILE(21332, "登录验证失败,请重新登录"),
    OAUTH2_TEMPORARILY_UNAVAILABLE(21333, "服务暂时无法访问");

    private final int value;
    private final String reasonPhrase;

    private RestFulStatus(int value, String reasonPhrase) {
        this.value = value;
        this.reasonPhrase = reasonPhrase;
    }

    public int value() {
        return this.value;
    }

    public String getReasonPhrase() {
        return this.reasonPhrase;
    }

    public String toString() {
        return Integer.toString(this.value);
    }

    public static RestFulStatus valueOf(int statusCode) {
        RestFulStatus[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            RestFulStatus status = var1[var3];
            if (status.value == statusCode) {
                return status;
            }
        }

        throw new IllegalArgumentException("No matching constant for [" + statusCode + "]");
    }
}
